import java.util.Scanner;

public class List {
	public Item head;
	List()
	{
		this.head = null;
	}
		
	public void append(int value) 
	{
		if (head == null) 
		{
			head = new Item(value);
		}
		else 
		{
			Item lastNode = head;
			while (lastNode.next != null)
				lastNode = lastNode.next;
			lastNode.next = new Item(value,null,lastNode);
		}
	}
	
	public void readList()
	{		
		Scanner in = new Scanner(System.in);
		int inNum = in.nextInt();
		for (int i = 0;i<inNum;i++)
		{
			int temp = in.nextInt();
			append(temp);
		}
				
	}
	
	void writeList()
	{
		Item lastNode = head;
		while (lastNode != null)
		{
			System.out.println(lastNode.value);
			lastNode = lastNode.next;			
		}
	}
	
	
	void swap (int from, int to )
	{
		if (this.head==null)
			return;
		Item itemTemp = this.head;
		while (itemTemp.next != null)
		{
			if (itemTemp.value == from)
			{
				itemTemp.value = to;
			}
			itemTemp = itemTemp.next;
		}
	}
}
